<script setup>
import { ref, onMounted } from 'vue';
import { userInfoPublicService } from '@/apis/user';
// 访问主页
const handleClick = (web) => {
  console.log("按钮被点击");
  window.open(web, '_blank');
}


const creatorInfo = ref({
  username: '',
  nickname: '',
  userPic: ''
})

const creatorList = async () => {
  let result = await userInfoPublicService("大流士三岁")
  creatorInfo.value.username = result.data.username;
  creatorInfo.value.nickname = result.data.nickname;
  creatorInfo.value.userPic = result.data.userPic;
}
onMounted(() => { creatorList() })
</script>

<template>
<el-card class="profile-info" shadow="never">
  <el-avatar shape="square" :fit="fill" :src="creatorInfo.userPic" :size="190" crossorigin="anonymous"/>
    <div class="user-details">
       <div class="nickname">
        {{ creatorInfo.nickname }}
      </div>
      <div class="talk">
        摸鱼摸鱼
      </div>
      <div class="follow">
        <el-button type="primary" size="small" class="follow-btn" @click="handleClick('https://space.bilibili.com/4669493')">
          <img src="@/assets/images/bilibili.png" alt="Follow Icon" class="bilibili-icon" />
        </el-button>
        <el-button type="primary" size="small" class="follow-btn" @click="handleClick('https://gitee.com/uu0510')">
          <img src="@/assets/images/github.png" alt="Follow Icon" class="github-icon" />
        </el-button>

      </div>
    </div>
</el-card>
</template>
<style scoped>
.profile-info {
  margin: 0;
  border: 0;
  width: 226.5px;
  height: 342px;
  background-color: rgb(083, 082, 085);
  display: flex;
  flex-direction: column;
  align-items: center;

  .user-details {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;

    .nickname {
      margin: 0 0 3px 0;
      color: rgb(232, 232, 232);
      font-size: 18px;
    }

    .talk {
      color: rgb(232, 232, 232);
      font-size: 16px;
      margin-bottom: 10px;
    }

    .follow {
      display: flex;
      align-items: center;

      .follow-btn {
        width: 40px;
        height: 35px;
        padding: 10px;
        font-size: 15px;
        background-color: rgb(255, 255, 255);
        border: none;
        color: #1c1c1c;

        &:hover {
          color: #ffffff;
          transform: translateY(-5px);
        }

        .bilibili-icon {
          width: 35px;
          /* 控制图标宽度 */
          height: 35px;
          /* 控制图标高度 */
          vertical-align: middle;
          /* 确保图片与文字垂直居中 */
        }

        .github-icon {
          width: 30px;
          /* 控制图标宽度 */
          height: 30px;
          /* 控制图标高度 */
          vertical-align: middle;
          /* 确保图片与文字垂直居中 */

        }
      }
    }
  }
}
</style>